OK, you've decided to make a new directory in the archive, this is where
you end up.
1domakedir:
2 lister set handle busy on
3 dopus getstring '"'getcatstr(15,'Enter directory name')'" 31 ""' getcatstr(16,'OK|Cancel')
4 dirtomake = result
5 if dirtomake == '' | dirtomake = 'RESULT' then
6 return
7
8 now = date('i') * 86400 + time('s')
9 call createdirs(dirtomake'/')
10
11 select
12 when arctype = 'LHA' then
13 address command 'LhA a -q -e -r -X -Qo "'patch(arcfile,0)'" T:ArcDir'handle'/' '"'patch(arcsubdir||dirtomake,1)'"'
14 when arctype = 'LZX' then do
15 oldcurrent = pragma('d')
16 call pragma('d','T:ArcDir'handle)
17 address command 'LZX a -q -e -r -X0 --' lzxkludge(patch(arcfile,0)) lzxkludge(patch(arcsubdir||dirtomake,0))
18 call pragma('d',oldcurrent)
19 end
20 end
21
22 if rc > 0 then
23 call displayerror(getcatstr(13,'Error while adding to archive.'))
24 else do
25 lister add handle '"'dirtomake'" -1 1' now '----rwed'
26 lister refresh handle
27 end
28
29 address command 'Delete >NIL: T:ArcDir'handle 'ALL QUIET'
30 call delete('T:ArcDir.list'handle)
31 return
Line:
1 Sub-routine label.
2 Set the lister to busy state, stop the user playing with it.
3 Put up a requester asking for the directory name, translating the
requester text if required with the getcatstr routine.
4 Get the result of the requester.
5 - 6 If it was an empty string or equalled 'RESULT' then return. This
means you couldn't make a directory called RESULT, this can be fixed
very easily by changing line 5 to read:
if dopusrc = 0 | dirtomake = '' then
8 We get the time since 1-Jan-1978 in seconds to use as the creation
date.
9 Call the createdirs routine with the name of our directory.
10 - 20 Depending upon the archive type, we now just add the directory
structure just created by createdirs to the archive, which of
course adds our new empty directory.
22 - 23 If the archiving wasn't successful we tell you about it.
24 - 27 Otherwise, we add an entry to the lister using lister add using the
time worked out in line 8.
29 Delete the directory structure created by createdirs .
30 Delete the archive contents list that ArcDir works from since we now
need a new one.
31 Return from whence we came.
|